<html>
<head><meta charset="utf-8"><title>Generating arbitrary MIR · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html">Generating arbitrary MIR</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="200203542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200203542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200203542">(Jun 09 2020 at 10:06)</a>:</h4>
<p>I'm very interested in finding out what people's opinions are on approaches to resolving <a href="https://github.com/rust-lang/miri/issues/196">https://github.com/rust-lang/miri/issues/196</a></p>



<a name="200203595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200203595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200203595">(Jun 09 2020 at 10:06)</a>:</h4>
<p>The most naive approach (and most labour intensive) would be to build a dedicated MIR front-end right?</p>



<a name="200203646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200203646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200203646">(Jun 09 2020 at 10:07)</a>:</h4>
<p>Would that ever be worthwhile?</p>



<a name="200284443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284443">(Jun 09 2020 at 20:18)</a>:</h4>
<p>I mean that would be pretty sweet</p>



<a name="200284503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284503">(Jun 09 2020 at 20:18)</a>:</h4>
<p>That would also probably help us testing the soundness of the MIR-opt transforms</p>



<a name="200284557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284557">(Jun 09 2020 at 20:19)</a>:</h4>
<p>I suspect that we might end up with something like that as part of the Sealed Rust effort, but probably only in a couple of years</p>



<a name="200284630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284630">(Jun 09 2020 at 20:20)</a>:</h4>
<p>Sealed Rust?</p>



<a name="200284648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284648">(Jun 09 2020 at 20:20)</a>:</h4>
<p>Ahhhh</p>



<a name="200284664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284664">(Jun 09 2020 at 20:20)</a>:</h4>
<p>Like no-source libraries?</p>



<a name="200284699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284699">(Jun 09 2020 at 20:20)</a>:</h4>
<p><a href="https://ferrous-systems.com/blog/sealed-rust-the-pitch/">https://ferrous-systems.com/blog/sealed-rust-the-pitch/</a></p>



<a name="200284735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284735">(Jun 09 2020 at 20:21)</a>:</h4>
<p>Thanks!</p>



<a name="200284801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284801">(Jun 09 2020 at 20:21)</a>:</h4>
<p>I think it could be useful for negative testing of MIR-optimizations</p>



<a name="200284885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284885">(Jun 09 2020 at 20:22)</a>:</h4>
<p>Like "given this weird MIR that's really difficult to generate from Rust, the optimization doesn't do the wrong thing"</p>



<a name="200284993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200284993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200284993">(Jun 09 2020 at 20:23)</a>:</h4>
<p>But it doesn't seem a huge priority to me</p>



<a name="200285171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200285171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200285171">(Jun 09 2020 at 20:25)</a>:</h4>
<p>Thinking about it, it would be something that should be fairly easy to build incrementally</p>



<a name="200285194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200285194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200285194">(Jun 09 2020 at 20:25)</a>:</h4>
<p>And could be done as part of the ramp up for Sealed Rust?</p>



<a name="200285406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200285406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200285406">(Jun 09 2020 at 20:27)</a>:</h4>
<p>Yeah, I think there are uses for it and some people would certainly like to have it, but I don't know it's something the compiler team would focus on in the next year or so</p>



<a name="200285417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200285417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200285417">(Jun 09 2020 at 20:27)</a>:</h4>
<p>That's my personal opinion</p>



<a name="200285588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200285588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200285588">(Jun 09 2020 at 20:28)</a>:</h4>
<p>yea, you could totally start out with just a parser extension that adds <code>mir foo(x: type) -&gt; ret_type</code> syntax and incrementally add features step by step. The easiest way to gauge whether it's worthwile to pursue without putting a lot of work into it is to write an MCP to the compiler team with a plan for how to do this</p>



<a name="200285964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Generating%20arbitrary%20MIR/near/200285964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Generating.20arbitrary.20MIR.html#200285964">(Jun 09 2020 at 20:31)</a>:</h4>
<p>Ok I'll give that a go! Thanks Oli!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>